package com.yourenbang.lingyun.transaction.config;

import com.yourenbang.lingyun.core.base.bean.OSSClientUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 阿里OSS配置类
 */
@RefreshScope
@Configuration
public class OSSClientConfig {

    @Setter @Getter
    @Value("${ali.oss.accessKeyId:LTAI5tFKtDKo12NqvXCmG3AV}")
    private String accessKeyId;
    @Setter @Getter
    @Value("${ali.oss.accessKeyRecect:eQlIxjmMkFrxWFNPsvAA1B9DlRXVYT}")
    private String accessKeyRecect;
    @Setter @Getter
    @Value("${ali.oss.bucketName}")
    private String bucketName;
    @Setter @Getter
    @Value("${ali.oss.endpoint}")
    private String endpoint;
    @Setter @Getter
    @Value("${ali.oss.url}")
    private String url;


    @Bean
    OSSClientUtil getOSSClient(){
        OSSClientUtil ossClient = new OSSClientUtil();
        ossClient.setAccessKeyId(accessKeyId);
        ossClient.setAccessKeyRecect(accessKeyRecect);
        ossClient.setBucketName(bucketName);
        ossClient.setEndpoint(endpoint);
        return ossClient;
    }

}
